package com.shsxt.crm.controller.customer;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.shsxt.common.util.Result;
import com.shsxt.crm.model.YgCustomerOrder;
import com.shsxt.crm.service.ICustomerOrderService;

@Controller
@RequestMapping("customer_order")
public class CustomerOrderController {

	@Autowired
	private ICustomerOrderService customerOrderService;

	@PostMapping("/queryOrdersByCid")
	@ResponseBody
	public Map<String, Object> queryOrdersByCid(Integer cid, @RequestParam(defaultValue = "1") Integer page,
			@RequestParam(defaultValue = "10") Integer rows) {
		return customerOrderService.queryOrdersByCid(cid, page, rows);
	}

	/**
	 * 查询客户订单
	 * 
	 * @param orderId
	 * @return
	 */
	@PostMapping("/queryCustoemrOrderByOrderId")
	@ResponseBody
	public Result<YgCustomerOrder> queryCustoemrOrderByOrderId(@RequestParam("orderId") Integer orderId) {
		return customerOrderService.queryCustoemrOrderByOrderId(orderId);
	}

	/**
	 * 查询订单商品详情
	 * 
	 * @param orderId
	 * @return
	 */
	@RequestMapping(value = "/queryOrderDetailsByOrderId", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> queryOrderDetailsByOrderId(@RequestParam("orderId") Integer orderId,
			@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
		return customerOrderService.queryOrderDetailsByOrderId(orderId, page, rows);
	}

}
